package top.yangbuyi.controller.system;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import top.yangbuyi.ExceptionHandelr.myException;
import top.yangbuyi.acpect.annotaction.Log;
import top.yangbuyi.acpect.enums.BusinessType;
import top.yangbuyi.dto.LoginInfoDto;
import top.yangbuyi.service.impl.LoginInfoService;
import top.yangbuyi.vo.AjaxResult;
import top.yangbuyi.vo.DataGridView;


/**
 * @description: 杨不易网站:www.yangbuyi.top
 * @program: yangbuyiopenHis2020
 * @ClassName: LoginInfoController
 * @create: 2020-09-01 15:44
 * @author: yangbuyi
 * @since： JDK1.8
 * @LoginInfoController: 登录日志$
 **/

@RestController
@Slf4j
@RequestMapping("system/loginInfo")
public class LogInfoController {

	  @Autowired
	  private LoginInfoService LoginInfoService;

	  /**
	   * @Description: 杨不易个人网址:http://yangbuyi.top
	   * 功能描述: 分页查询操作日志
	   * @Author: TeouBle
	   * @Date: 2020/9/1 15:44
	   */
	  @GetMapping("listForPage")
	  public AjaxResult listForPage(LoginInfoDto LoginInfoDto) throws Exception {
			DataGridView gridView = LoginInfoService.listForPage(LoginInfoDto);
			return AjaxResult.success("查询成功", gridView.getData(), gridView.getTotal());
	  }

	  /**
	   * 删除
	   */
	  @DeleteMapping("deleteLoginInfoByIds/{infoIds}")
	  @Log(title = "删除指定登录日志数据", businessType = BusinessType.DELETE)
	  public AjaxResult deleteLoginInfoByIds(@PathVariable Long[] infoIds) throws Exception {
			return AjaxResult.toAjax(this.LoginInfoService.deleteLoginInfoByIds(infoIds));
	  }

	  /**
	   * 清空删除
	   */
	  @DeleteMapping("clearLoginInfo")
	  @Log(title = "清空登录日志数据", businessType = BusinessType.DELETE)
	  public AjaxResult clearAllLoginInfo() throws myException {
			return AjaxResult.toAjax(this.LoginInfoService.clearLoginInfo());
	  }

}
